From: Gerd Moellmann Date: Wed, 18 Apr 2001 15:34:35 +0000 (+0000) Subject: (Finsert_file_contents): If the file size returned from X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~40648 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=94a54198c9addf14f6ed047194a514a31ef2a359;p=emacs.git (Finsert_file_contents): If the file size returned from stat is zero, set END to READ_BUF_SIZE. This makes sure we can read from files on a procfs whose contents are generated dynamically. --- diff --git a/src/fileio.c b/src/fileio.c index 84a0c6c625c..8b6c0bd165a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3589,6 +3589,12 @@ actually used.") if (XINT (end) != st.st_size || ((int) st.st_size * 4) / 4 != st.st_size) error ("Maximum buffer size exceeded"); + + /* The file size returned from stat may be zero, but data + may be readable nonetheless, for example when this is a + file in the /proc filesystem. */ + if (st.st_size == 0) + XSETINT (end, READ_BUF_SIZE); } }